<template>
    <div >
      <ProjectItem :item="itemData"/>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRoute } from 'vue-router';
import router from '../router/router';
import store from '../store/store';
import testData from './data';
import ProjectItem from '../components/projectItem.vue'


const id =ref("")
const itemData = ref({})
const  getQueryVariable =() =>{
  try {
    id.value = location.href.split("?id=")[1]; //获取url中"?"符后的字串
  } catch (error) {
  }
  console.log(id.value);
}
// if(!store.getters.userInfo.id){
//   router.push({path:"/"})
// }
// 随机
const randomItem = ()=>{
  let index  =Math.floor(Math.random(0,testData.listData.length)*10)
  itemData.value =testData.listData[index] 
  console.log(itemData.value);
}
randomItem();
getQueryVariable();
</script>

<style lang="scss" scoped>

</style>